home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / DELPHI / INCEVAL.ZIP / DEMOFORM.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1996-11-15  |  14.7 KB  |  432 lines

  1. unit DemoForm;
  2. {******************************************************************************}
  3. {                                                                              }
  4. {                           IMPORTANT NOTICE                                   }
  5. {                                                                              }
  6. {          (c) Copyright 1996 by Softouch Development Incorporated             }
  7. {                                                                              }
  8. {                         ALL RIGHTS RESERVED                                  }
  9. {                                                                              }
  10. {       Software and documentation are the confidential property and           }
  11. {       contain trade secrets of Softouch Development Incorporated.            }
  12. {       Any copying, use, disclosure, modification, or transfer by rental,     }
  13. {       sale, or otherwise without the written consent of Softouch             }
  14. {       Development Incorporated is strictly prohibited.                       }
  15. {                                                                              }
  16. {       Portions may be Copyright (c) 1995 Borland International.              }
  17. {       All restriction apply.                                                 }
  18. {******************************************************************************}
  19. {                                                                              }
  20. {  Problem Log                                                                 }
  21. {  Version 2.6                                                                 }
  22. {  08/23/96  Changed some records to be sorted and changed some descriptions.  }
  23. {******************************************************************************}
  24. interface
  25.  
  26. uses
  27.   {$IFDEF WIN32}
  28.   Windows, ComCtrls, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  29.   Dialogs, StdCtrls, ExtCtrls, IncBase, IncDBLup, Tabnotbk, IncCombo,
  30.   Buttons, DBTables, DB, Grids, DBGrids, IncDBCmb, Mask, DBCtrls, IncDBSrc;
  31.   {$ELSE}
  32.   WinTypes, WinProcs, Messages, SysUtils, Classes, Graphics, Controls, Forms,
  33.   Dialogs, StdCtrls, ExtCtrls, IncBase, IncDBLup, Tabnotbk, IncCombo,
  34.   Buttons, DBTables, DB, Grids, DBGrids, IncDBCmb, Mask, DBCtrls, IncDBSrc;
  35.   {$ENDIF}
  36.  
  37. type
  38.   TForm_Main = class(TForm)
  39.     TabbedNotebook_Main: TTabbedNotebook;
  40.     Panel1: TPanel;
  41.     DataSource_Orders: TDataSource;
  42.     Table_Customer: TTable;
  43.     DataSource_Customer: TDataSource;
  44.     Query_Parts: TQuery;
  45.     DataSource_Parts: TDataSource;
  46.     Query_Vendor: TQuery;
  47.     DataSource_Vendor: TDataSource;
  48.     Query_PartsPartNo: TFloatField;
  49.     Query_PartsVendorNo: TFloatField;
  50.     Query_PartsDescription: TStringField;
  51.     Query_PartsOnHand: TFloatField;
  52.     Query_PartsOnOrder: TFloatField;
  53.     Query_PartsCost: TCurrencyField;
  54.     Query_PartsListPrice: TCurrencyField;
  55.     DataSource_BioLife: TDataSource;
  56.     Panel_NavigationUpper: TPanel;
  57.     Label16: TLabel;
  58.     DBIncSearchCombo2: TDBIncSearchCombo;
  59.     DBImage1: TDBImage;
  60.     DBMemo1: TDBMemo;
  61.     DBNavigator_Navigation: TDBNavigator;
  62.     Query_BioLife: TQuery;
  63.     Panel_LookupUpper: TPanel;
  64.     DBIncLookupCombo_General: TDBIncLookupCombo;
  65.     GroupBox_ComboOptions: TGroupBox;
  66.     Label12: TLabel;
  67.     Label13: TLabel;
  68.     Label14: TLabel;
  69.     Label15: TLabel;
  70.     IncCombo_AutoDropDown: TIncCombo;
  71.     IncCombo_BorderStyle: TIncCombo;
  72.     IncCombo_ShowComboButton: TIncCombo;
  73.     IncCombo_Style: TIncCombo;
  74.     CheckBox_CanBeBlank: TCheckBox;
  75.     CheckBox_Ctl3D: TCheckBox;
  76.     GroupBox_DropDownOptions: TGroupBox;
  77.     Label1: TLabel;
  78.     Label2: TLabel;
  79.     Label3: TLabel;
  80.     Label4: TLabel;
  81.     CheckBox_Titles: TCheckBox;
  82.     CheckBox_RowLines: TCheckBox;
  83.     CheckBox_ColLines: TCheckBox;
  84.     BitBtn1: TBitBtn;
  85.     BitBtn2: TBitBtn;
  86.     IncCombo_AlignHorizontally: TIncCombo;
  87.     IncCombo_AlignVertically: TIncCombo;
  88.     IncCombo_Color: TIncCombo;
  89.     IncCombo_TitleColor: TIncCombo;
  90.     Panel_GridUpper: TPanel;
  91.     DBGrid_Main: TDBGrid;
  92.     DBIncLookupCombo_CustomerName: TDBIncLookupCombo;
  93.     DBIncCombo1: TDBIncCombo;
  94.     Panel_SQLUpper: TPanel;
  95.     Label5: TLabel;
  96.     DBIncSearchCombo_PartNo: TDBIncSearchCombo;
  97.     Label6: TLabel;
  98.     DBEdit_Description: TDBEdit;
  99.     DBIncLookupCombo_Vendor: TDBIncLookupCombo;
  100.     Label7: TLabel;
  101.     Label8: TLabel;
  102.     DBEdit_OnHand: TDBEdit;
  103.     DBEdit_OnOrder: TDBEdit;
  104.     Label9: TLabel;
  105.     Label10: TLabel;
  106.     DBEdit_Cost: TDBEdit;
  107.     DBEdit_ListPrice: TDBEdit;
  108.     Label11: TLabel;
  109.     DBNavigator_SQL: TDBNavigator;
  110.     Panel_GeneralUpper: TPanel;
  111.     ProgramIcon: TImage;
  112.     ProductName: TLabel;
  113.     Label17: TLabel;
  114.     Label18: TLabel;
  115.     ScrollBox2: TScrollBox;
  116.     Label19: TLabel;
  117.     Label20: TLabel;
  118.     Label21: TLabel;
  119.     Label22: TLabel;
  120.     Label23: TLabel;
  121.     Label24: TLabel;
  122.     Label25: TLabel;
  123.     Label26: TLabel;
  124.     Label27: TLabel;
  125.     Label28: TLabel;
  126.     Label29: TLabel;
  127.     Label30: TLabel;
  128.     Label31: TLabel;
  129.     Label32: TLabel;
  130.     Label33: TLabel;
  131.     BitBtn3: TBitBtn;
  132.     FontDialog1: TFontDialog;
  133.     IncCombo_ButtonCursor: TIncCombo;
  134.     Label34: TLabel;
  135.     Memo_Lookups: TMemo;
  136.     Memo_Navigation: TMemo;
  137.     Memo_Grid: TMemo;
  138.     Memo_SQL: TMemo;
  139.     Table_Orders: TTable;
  140.     Table_OrdersOrderNo: TFloatField;
  141.     Table_OrdersCustNo: TFloatField;
  142.     Table_OrdersPaymentMethod: TStringField;
  143.     Table_OrdersCustomerName: TStringField;
  144.     Table_CustomerLookups: TTable;
  145.     DataSource_CustomerLookups: TDataSource;
  146.     ScrollBox1: TScrollBox;
  147.     Price: TLabel;
  148.     OnCompuserveTitle: TLabel;
  149.     OnCompuserve: TLabel;
  150.     NorthStarTitle: TLabel;
  151.     NorthStar800: TLabel;
  152.     NorthStarVoice: TLabel;
  153.     NorthStar803: TLabel;
  154.     NorthStarFax: TLabel;
  155.     NorthStarFax800: TLabel;
  156.     NorthStarEMail: TLabel;
  157.     NorthStarAOL: TLabel;
  158.     NorthStarCompuserve: TLabel;
  159.     NorthStarInternet: TLabel;
  160.     NorthStarImportantNotes: TLabel;
  161.     Mail: TLabel;
  162.     MailName: TLabel;
  163.     MailAddress: TLabel;
  164.     MailCityStateZip: TLabel;
  165.     MailInfo: TLabel;
  166.     Table_CustomerNameGridCalc: TTable;
  167.     label35: TLabel;
  168.     procedure DBIncLookupCombo_GeneralNewRecord(Sender: TObject;
  169.       DataSet: TDataSet; NewValue: string);
  170.     procedure FormCreate(Sender: TObject);
  171.      procedure IncCombo_AutoDropDownClick(Sender: TObject);
  172.     procedure IncCombo_BorderStyleClick(Sender: TObject);
  173.     procedure IncCombo_ShowComboButtonClick(Sender: TObject);
  174.     procedure IncCombo_StyleClick(Sender: TObject);
  175.     procedure IncCombo_AlignHorizontallyChange(Sender: TObject);
  176.     procedure IncCombo_AlignVerticallyChange(Sender: TObject);
  177.     procedure CheckBox_ColLinesClick(Sender: TObject);
  178.     procedure CheckBox_RowLinesClick(Sender: TObject);
  179.     procedure CheckBox_TitlesClick(Sender: TObject);
  180.     procedure BitBtn3Click(Sender: TObject);
  181.     procedure IncCombo_ColorChange(Sender: TObject);
  182.     procedure IncCombo_TitleColorChange(Sender: TObject);
  183.     procedure BitBtn1Click(Sender: TObject);
  184.     procedure BitBtn2Click(Sender: TObject);
  185.     procedure CheckBox_CanBeBlankClick(Sender: TObject);
  186.     procedure CheckBox_Ctl3DClick(Sender: TObject);
  187.     procedure IncCombo_ButtonCursorChange(Sender: TObject);
  188.     procedure Table_OrdersCalcFields(DataSet: TDataset);
  189.     procedure FormActivate(Sender: TObject);
  190.     procedure FormDestroy(Sender: TObject);
  191.   private
  192.         procedure SetFields;
  193.         procedure LoadColors(const S: string);
  194.         procedure LoadCursors(const S: string);
  195.      { Private declarations }
  196.   public
  197.     { Public declarations }
  198.   end;
  199.  
  200.   TExposedCustomEdit = class(TCustomEdit)
  201.   end;
  202.  
  203. var
  204.   Form_Main: TForm_Main;
  205.  
  206. implementation
  207.  
  208. {$R *.DFM}
  209.  
  210. procedure TForm_Main.DBIncLookupCombo_GeneralNewRecord(Sender: TObject;
  211.   DataSet: TDataSet; NewValue: string);
  212. begin
  213.     MessageDlg('You have entered a new item that would typically be added at this point using the OnNewRecord event',
  214.     mtInformation,[mbOK],0);
  215.     Abort;
  216. end;
  217.  
  218. procedure TForm_Main.FormCreate(Sender: TObject);
  219. var i: Integer;
  220. begin
  221.     { This fixes the autosize problem }
  222.     for i := 0 to ComponentCount-1 do
  223.         begin
  224.         if Components[i] is TLabel then
  225.             begin
  226.             TLabel(Components[i]).AutoSize := not TLabel(Components[i]).AutoSize;
  227.             TLabel(Components[i]).AutoSize := not TLabel(Components[i]).AutoSize;
  228.             end;
  229.         if Components[i] is TImage then
  230.             begin
  231.             TImage(Components[i]).AutoSize := not TImage(Components[i]).AutoSize;
  232.             TImage(Components[i]).AutoSize := not TImage(Components[i]).AutoSize;
  233.             end;
  234.         if (Components[i] is TCustomEdit)
  235.         and not (Components[i] is TCustomMemo) then
  236.             begin
  237.             TExposedCustomEdit(Components[i]).AutoSize := not TExposedCustomEdit(Components[i]).AutoSize;
  238.             TExposedCustomEdit(Components[i]).AutoSize := not TExposedCustomEdit(Components[i]).AutoSize;
  239.             end;
  240.         end;
  241.  
  242.     GetColorValues(LoadColors);
  243.     GetCursorValues(LoadCursors);
  244.     SetFields;
  245. end;
  246.  
  247. procedure TForm_Main.SetFields;
  248. var Temp: String;
  249. begin
  250.     with DBIncLookupCombo_General do
  251.         begin
  252.         IncCombo_AutoDropDown.ItemIndex    := Ord(AutoDropDown);
  253.         IncCombo_BorderStyle.ItemIndex     := Ord(BorderStyle);
  254.         IncCombo_ShowComboButton.ItemIndex := Ord(ShowComboButton);
  255.         IncCombo_Style.ItemIndex           := Ord(Style);
  256.         CheckBox_CanBeBlank.Checked        := CanBeBlank;
  257.         CheckBox_Ctl3D.Checked             := Ctl3D;
  258.         IncCombo_AlignHorizontally.ItemIndex := Ord(DropDownOptions.AlignHorizontally);
  259.         IncCombo_AlignVertically.ItemIndex   := Ord(DropDownOptions.AlignVertically);
  260.         CheckBox_ColLines.Checked := DropDownOptions.ColLines;
  261.         CheckBox_RowLines.Checked := DropDownOptions.RowLines;
  262.         CheckBox_Titles.Checked   := DropDownOptions.Titles;
  263.         Temp := ColorToString(DropDownOptions.Color);
  264.         Delete(Temp,1,2);
  265.         IncCombo_Color.ItemIndex := IncCombo_Color.Items.IndexOf(Temp);
  266.         Temp := ColorToString(DropDownOptions.TitleColor);
  267.         Delete(Temp,1,2);
  268.         IncCombo_TitleColor.ItemIndex := IncCombo_TitleColor.Items.IndexOf(Temp);
  269.         Temp := CursorToString(ButtonCursor);
  270.         Delete(Temp,1,2);
  271.         IncCombo_ButtonCursor.ItemIndex := IncCombo_ButtonCursor.Items.IndexOf(Temp);
  272.         end;
  273. end;
  274.  
  275.  
  276. procedure TForm_Main.IncCombo_AutoDropDownClick(Sender: TObject);
  277. begin
  278.     DBIncLookupCombo_General.AutoDropDown := TAutoDropDown(IncCombo_AutoDropDown.ItemIndex);
  279. end;
  280.  
  281. procedure TForm_Main.IncCombo_BorderStyleClick(Sender: TObject);
  282. begin
  283.     DBIncLookupCombo_General.BorderStyle := TBorderStyle(IncCombo_BorderStyle.ItemIndex);
  284. end;
  285.  
  286. procedure TForm_Main.IncCombo_ShowComboButtonClick(Sender: TObject);
  287. begin
  288.     DBIncLookupCombo_General.ShowComboButton := TShowComboButton(IncCombo_ShowComboButton.ItemIndex);
  289. end;
  290.  
  291. procedure TForm_Main.IncCombo_StyleClick(Sender: TObject);
  292. begin
  293.     DBIncLookupCombo_General.Style := TComboStyle(IncCombo_Style.ItemIndex);
  294. end;
  295.  
  296. procedure TForm_Main.IncCombo_AlignHorizontallyChange(Sender: TObject);
  297. begin
  298.     DBIncLookupCombo_General.DropDownOptions.AlignHorizontally :=
  299.     TDropDownAlignHorizontally(IncCombo_AlignHorizontally.ItemIndex);
  300. end;
  301.  
  302. procedure TForm_Main.IncCombo_AlignVerticallyChange(Sender: TObject);
  303. begin
  304.     DBIncLookupCombo_General.DropDownOptions.AlignVertically :=
  305.     TDropDownAlignVertically(IncCombo_AlignVertically.ItemIndex);
  306. end;
  307.  
  308. procedure TForm_Main.CheckBox_ColLinesClick(Sender: TObject);
  309. begin
  310.     DBIncLookupCombo_General.DropDownOptions.ColLines := CheckBox_ColLines.Checked;
  311. end;
  312.  
  313. procedure TForm_Main.CheckBox_RowLinesClick(Sender: TObject);
  314. begin
  315.     DBIncLookupCombo_General.DropDownOptions.RowLines := CheckBox_RowLines.Checked;
  316. end;
  317.  
  318. procedure TForm_Main.CheckBox_TitlesClick(Sender: TObject);
  319. begin
  320.     DBIncLookupCombo_General.DropDownOptions.Titles := CheckBox_Titles.Checked;
  321. end;
  322.  
  323. procedure TForm_Main.BitBtn3Click(Sender: TObject);
  324. begin
  325.     Close;
  326. end;
  327.  
  328. procedure TForm_Main.LoadColors(const S: string);
  329. var DisplayColor: String;
  330. begin
  331.     DisplayColor := S;
  332.     Delete(DisplayColor,1,2);
  333.     IncCombo_Color.Items.Add(DisplayColor);
  334.     IncCombo_TitleColor.Items.Add(DisplayColor);
  335. end;
  336.  
  337.  
  338. procedure TForm_Main.IncCombo_ColorChange(Sender: TObject);
  339. var AColor: LongInt;
  340. begin
  341.     IdentToColor('cl'+IncCombo_Color.Text,LongInt(AColor));
  342.     DBIncLookupCombo_General.DropDownOptions.Color := TColor(AColor);
  343. end;
  344.  
  345. procedure TForm_Main.IncCombo_TitleColorChange(Sender: TObject);
  346. var AColor: LongInt;
  347. begin
  348.     IdentToColor('cl'+IncCombo_TitleColor.Text,LongInt(AColor));
  349.     DBIncLookupCombo_General.DropDownOptions.TitleColor := TColor(AColor);
  350. end;
  351.  
  352. procedure TForm_Main.BitBtn1Click(Sender: TObject);
  353. begin
  354.     FontDialog1.Font.Assign(DBIncLookupCombo_General.DropDownOptions.Font);
  355.     if FontDialog1.Execute then
  356.         DBIncLookupCombo_General.DropDownOptions.Font.Assign(FontDialog1.Font);
  357. end;
  358.  
  359. procedure TForm_Main.BitBtn2Click(Sender: TObject);
  360. begin
  361.     FontDialog1.Font.Assign(DBIncLookupCombo_General.DropDownOptions.TitleFont);
  362.     if FontDialog1.Execute then
  363.         DBIncLookupCombo_General.DropDownOptions.TitleFont.Assign(FontDialog1.Font);
  364. end;
  365.  
  366. procedure TForm_Main.CheckBox_CanBeBlankClick(Sender: TObject);
  367. begin
  368.     DBIncLookupCombo_General.CanBeBlank := CheckBox_CanBeBlank.Checked;
  369. end;
  370.  
  371. procedure TForm_Main.CheckBox_Ctl3DClick(Sender: TObject);
  372. begin
  373.     DBIncLookupCombo_General.Ctl3D := CheckBox_Ctl3D.Checked;
  374. end;
  375.  
  376. procedure TForm_Main.LoadCursors(const S: string);
  377. var DisplayCursor: String;
  378. begin
  379.     DisplayCursor := S;
  380.     Delete(DisplayCursor,1,2);
  381.     IncCombo_ButtonCursor.Items.Add(DisplayCursor);
  382. end;
  383.  
  384. procedure TForm_Main.IncCombo_ButtonCursorChange(Sender: TObject);
  385. var ACursor: LongInt;
  386. begin
  387.     IdentToCursor('cr'+IncCombo_ButtonCursor.Text,LongInt(ACursor));
  388.     DBIncLookupCombo_General.ButtonCursor := TCursor(ACursor);
  389. end;
  390.  
  391. procedure TForm_Main.Table_OrdersCalcFields(DataSet: TDataset);
  392. begin
  393.     with Table_CustomerNameGridCalc do
  394.         begin
  395.         if Active and FindKey([DataSet.FieldByName('CustNo').AsString]) then
  396.             DataSet.FieldByName('CustomerName').AsString := FieldByName('Company').AsString;
  397.         end;
  398. end;
  399.  
  400. procedure TForm_Main.FormActivate(Sender: TObject);
  401. begin
  402.    TabbedNotebook_Main.ActivePage := 'General';
  403.     Application.ProcessMessages;
  404.     Screen.Cursor := crHourGlass;
  405.     try
  406.         Table_Orders.Active := True;
  407.         Table_Customer.Active := True;
  408.         Table_CustomerLookups.Active := True;
  409.         Table_CustomerNameGridCalc.Active := True;
  410.         Query_Parts.Active := True;
  411.         Query_Vendor.Active := True;
  412.         Query_BioLife.Active := True;
  413.         Table_Orders.Refresh;
  414.     finally
  415.         Screen.Cursor := crDefault;
  416.         end;
  417.     Repaint;
  418. end;
  419.  
  420. procedure TForm_Main.FormDestroy(Sender: TObject);
  421. begin
  422.     Table_Orders.Active := False;
  423.     Table_Customer.Active := False;
  424.     Table_CustomerLookups.Active := False;
  425.     Table_CustomerNameGridCalc.Active := False;
  426.     Query_Parts.Active := False;
  427.     Query_Vendor.Active := False;
  428.     Query_BioLife.Active := False;
  429. end;
  430.  
  431. end.
  432.